import request from '@/utils/request';

/**
 * 上传方案
 * <p>
 * @param {FormData} formOfFile
 * @return {void}
 */
export function uploadProposal(formOfFile) {
  return request({
    url: '/txs/service_quanan/upload',
    method: 'post',
    data: formOfFile,
  });
}

/**
 * 添加或保存
 * <p>
 * @param {Object} data 全案信息
 * @return {Promise}
 */
export function saveQuanAn(data) {
  return request({
    url: '/txs/service_quanan/save',
    method: 'put',
    data: data,
  });
}

/**
 * 删除全案信息
 * <p>
 * @param {number} id 主键ID
 * @return {Promise}
 */
export function delQuanAn(id) {
  return request({
    url: '/txs/service_quanan/del',
    method: 'delete',
    params: { id },
  });
}

/**
 * 上架
 * <p>
 * @param {number} id 主键ID
 * @return {Promise}
 */
export function publishQuanAn(id) {
  return request({
    url: '/txs/service_quanan/publish',
    method: 'put',
    params: { id },
  });
}

/**
 * 下架
 * <p>
 * @param {number} id 主键ID
 * @return {Promise}
 */
export function reclaimQuanAn(id) {
  return request({
    url: '/txs/service_quanan/reclaim',
    method: 'put',
    params: { id },
  });
}

/**
 * 查询全案信息列表
 * <ul>
 * <li> {number} pageNumber</li>
 * <li> {number} pageSize</li>
 * <li> {number} scheme 类型</li>
 * <li> {string} brief 类型</li>
 * <li> {number} pub</li>
 * </ul>
 * @param {Object} params
 * @return {Promise}
 */
export function getQuanAnPage(params) {
  return request({
    url: '/txs/service_quanan/page',
    method: 'get',
    params: params,
  });
}

/**
 * 获取用户符合的最近上架的全案，最多查询出 10 个
 * @param {number} cid 顾客主键ID
 * @return {Promise}
 */
export function checkoutQuanByClerk(cid) {
  return request({
    url: '/txs/service_quanan/clerk/checkout',
    method: 'get',
    params: { cid },
  });
}
